package com.bookstore.common.exception;

/**
 * 参数验证异常
 * 用于处理参数验证失败的异常情况
 */
public class ValidationException extends BusinessException {
    private static final long serialVersionUID = 1L;

    /**
     * 验证失败的字段名
     */
    private String fieldName;

    /**
     * 验证失败的字段值
     */
    private Object fieldValue;

    public ValidationException(String message) {
        super(message);
    }
    public ValidationException(String message, String fieldName, Object fieldValue) {
        super(message);
        this.fieldName = fieldName;
        this.fieldValue = fieldValue;
    }

    public ValidationException(String errorCode, String message, String fieldName, Object fieldValue) {
        super(errorCode, message);
        this.fieldName = fieldName;
        this.fieldValue = fieldValue;
    }

    public String getFieldName() {
        return fieldName;
    }

    public Object getFieldValue() {
        return fieldValue;
    }
}